<?php 
namespace Qwadmin\Controller;

class ShenController extends ComController
{

	public function index()
	{
		// echo '11111';
        $blist = M('stock')->where(['x_type'=>1])->select(); //办公用品
        $llist = M('stock')->where(['x_type'=>2])->select(); //劳保用品
        $zlist = M('stock')->where(['x_type'=>3])->select(); //招待用品
        // $gblist = M('stock')->where(['type'=>2,'x_type'=>1])->select(); //办公用品
        // $gllist = M('stock')->where(['type'=>2,'x_type'=>2])->select(); //劳保用品
        // $gzlist = M('stock')->where(['type'=>2,'x_type'=>3])->select(); //招待用品
        // dump($gblist);
        // exit;
        $this->assign('blist',$blist) ;  
        $this->assign('llist',$llist) ;
        $this->assign('zlist',$zlist) ;
        // $this->assign('gblist',$gblist) ;  
        // $this->assign('gllist',$gllist) ;
        // $this->assign('gzlist',$gzlist) ;
		    $this->display();
	}





	public function che()
	{
    $list = M('safe')->select();
    $y_list = M('card')->where(array('type'=>1))->select();
    $this->assign('ylist',$y_list) ;
    $this->assign('list',$list);
		$this->display();
	}


  //物资申请添加
	public function add()
	{
        // dump($_POST);
        // exit;
        
          $ku = M('stock')->where(['id'=>$_POST['id']])->find();
          if ($_POST['num'] > $ku['number']) {
                    echo '3333';
                    exit;
                  }
            $dada = M('member')->where(array('uid'=>$_SESSION['uid']))->select();

            // dump($dada);
            $z_id = M('auth_group_access')->where(array('uid'=>$_SESSION['uid']))->select();
            
            $b_id = $z_id[0]['group_id'];
            $m_list = M('auth_group')->where(array('id'=>$b_id))->select();
            $slist = M('stock')->where(['id'=>$_POST['id']])->select();
            // dump($m_list);
            // exit;
            switch ($_POST['x_type']) {
              case '1':
                $arr['x_type'] = '办公用品';
                $date['wtype'] = '办公用品';
                break;
              case '2':
                $arr['x_type'] = '劳务用品';
                $date['wtype'] = '劳务用品';
                break;
              case '3':
                $arr['x_type'] = '招待用品';
                $date['wtype'] = '招待用品';
                break;
            }
           
            // dump($dada[0]['m_type']);
            // exit;
            switch ($dada[0]['m_type']) {
                  case '2':  //主管
                        // dump($_POST);
                        // exit;
                        if ($m_list[0]['post'] == '行政中心') {
                            
                            $arr['num'] = $slist[0]['num'];

                            $arr['com'] = $slist[0]['com'];
                            $arr['wname'] = $slist[0]['name'];
                            $arr['type'] = $_POST['type'];
                            $arr['unit'] = $slist[0]['unit'];
                            $arr['wid'] = $slist[0]['id'];
                            $arr['x_type'] = $slist[0]['x_type'];
                            // dump($arr['unit']);
                            // exit;
                            $arr['number'] = $slist[0]['number'];
                            $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                            $arr['ment'] = $m_list[0]['post'];
                            $arr['uname'] = $dada[0]['user'];
                            $arr['time'] = date('Y-m-d');
                            $arr['look'] = '8';  
                            if (M('look')->add($arr) > 0) {
                                $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                                $date['zname'] = $dada[0]['user'];
                                $date['ztype'] = $dada[0]['m_type'];
                                $date['type'] = $_POST['type'];
                                $date['stype'] = 1;
                                $date['ztime'] = date('Y-m-d');
                                $date['sid'] = $llist[0]['id'];
                                

                               if (M('sh')->add($date) > 0) {
                                     echo '1111';
                                } 

                            }else{
                                echo '2222';
                            }



                        }else{
                            if ($m_list[0]['post'] == '采购中心') {

                                
                                $arr['num'] = $_POST['num'];
                                $arr['com'] = $slist[0]['com'];
                                $arr['wname'] = $slist[0]['name'];
                                $arr['type'] = $_POST['type'];
                                $arr['unit'] = $slist[0]['unit'];
                                $arr['wid'] = $slist[0]['id'];
                                $arr['x_type'] = $slist[0]['x_type'];
                                // dump($arr['unit']);
                                // exit;
                                $arr['number'] = $slist[0]['number'];
                                $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                                $arr['ment'] = $m_list[0]['post'];
                                $arr['uname'] = $dada[0]['user'];
                                $arr['time'] = date('Y-m-d');
                                $arr['look'] = '9';

                                if (M('look')->add($arr) > 0) {
                                    $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                                //      dump($llist);
                                // exit;
                                    $date['zname'] = $dada[0]['user'];
                                    $date['ztype'] = $dada[0]['m_type'];
                                    $date['stype'] = 1;
                                    $date['ztime'] = date('Y-m-d');
                                    $date['sid'] = $llist[0]['id'];
                                  

                                   if (M('sh')->add($date) > 0) {
                                         echo '1111';
                                    } 

                                }else{
                                    echo '2222';
                                }


                              
                            }else{
                                if ($m_list[0]['post'] == '财务中心') {
                                    
                                     $arr['num'] = $_POST['num'];
                                    $arr['com'] = $slist[0]['com'];
                                    $arr['wname'] = $slist[0]['name'];
                                    $arr['type'] = $_POST['type'];
                                    $arr['unit'] = $slist[0]['unit'];
                                    $arr['wid'] = $slist[0]['id'];
                                    $arr['x_type'] = $slist[0]['x_type'];
                                    // dump($arr['unit']);
                                    // exit;
                                    $arr['number'] = $slist[0]['number'];
                                    $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                                    $arr['ment'] = $m_list[0]['post'];
                                    $arr['uname'] = $dada[0]['user'];
                                    $arr['time'] = date('Y-m-d'); 
                                    $arr['look'] = '10'; 
                                    if (M('look')->add($arr) > 0) {
                                        $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                                        $date['zname'] = $dada[0]['user'];
                                        $date['ztype'] = $dada[0]['m_type'];
                                        $date['stype'] = 1;
                                        $date['ztime'] = date('Y-m-d');
                                        $date['sid'] = $llist[0]['id'];
                                      

                                       if (M('sh')->add($date) > 0) {
                                             echo '1111';
                                        } 

                                    }else{
                                        echo '2222';
                                    }
                                }else{
                                  // echo '12';
                                  // exit;
                                    
                                        $arr['num'] = $_POST['num'];
                                        $arr['com'] = $slist[0]['com'];
                                        $arr['wname'] = $slist[0]['name'];
                                        $arr['type'] = $_POST['type'];
                                        $arr['unit'] = $slist[0]['unit'];
                                        $arr['wid'] = $slist[0]['id'];
                                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                                        $arr['number'] = $slist[0]['number'];
                                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                                        $arr['ment'] = $m_list[0]['post'];
                                        $arr['uname'] = $dada[0]['user'];
                                        $arr['time'] = date('Y-m-d'); 
                                        $arr['look'] = '1';  
                                    if (M('look')->add($arr) > 0) {
                                        $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                                        $date['zname'] = $dada[0]['user'];
                                        $date['ztype'] = $dada[0]['m_type'];
                                        $date['stype'] = 1;
                                        $date['ztime'] = date('Y-m-d');
                                        $date['sid'] = $llist[0]['id'];
                                      

                                       if (M('sh')->add($date) > 0) {
                                             echo '1111';
                                        } 

                                    }else{
                                        echo '2222';
                                    }
                                }
                            }
                        }
                    break;
                  case '3':  //经理
                      // echo '111';
                      // exit;
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d'); 
                       
                        $arr['look'] = '2';
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['jtime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                      

                          if (M('sh')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;
                  case '4':  //行政
                      
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                       
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');    
                        $arr['look'] = '2';
                         // dump($arr);
                         //                exit;
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['zname'] = $dada[0]['user'];
                          $date['ztype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['ztime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['jtime'] = date('Y-m-d');
             

                          if (M('sh')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;
                  case '5':   //财务
                       
                       $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');    
                        $arr['look'] = '10'; 
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['zname'] = $dada[0]['user'];
                          $date['ztype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['ztime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                    
                          if (M('sh')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;

                 case '10':   //财务
                       
                       $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');    
                        $arr['look'] = '10'; 
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['zname'] = $dada[0]['user'];
                          $date['ztype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['ztime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                    
                          if (M('sh')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;



                  case '8':   //职能总
                      
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');   
                        $arr['look'] = '2'; 
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['jtime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                  

                          if (M('sh')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;
                  case '9':   //网络总
                      
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');   
                        $arr['look'] = '2'; 
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['jtime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                

                          if (M('sh')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;
                case '0':
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d'); 
                      // dump($list);
                      // exit;
                     if (M('look')->add($arr) > 0) {
                          echo '1111';
                      }else{
                          echo '2222';
                      }
                    break;
            










 }





		// $Shen= M('xshen');
		// $store_id = $_POST;
		// // dump($store_id);
  // //       exit;
  //       $store_id = array_values($store_id);
        
  //       $n = '0';
  //       foreach ($store_id as $k => $v) {
  //           if ($k%4 != 0) {
  //               $con = $k%4;
  //               switch ($con) {
  //                   case 0:
  //                       $arr[$n]['x_type'] = $v;break;
  //                   case 1:
  //                       $arr[$n]['name'] = $v;break;
  //                   case 2:
  //                       $arr[$n]['content'] = $v;break;
  //                   case 3:
  //                       $arr[$n]['time'] = $v;break;
  //               }
  //               $map[$n][] = $v;
  //           } else {
  //               $n++;
  //               $con = $k%4;
  //               switch ($con) {
  //                   case 0:
  //                       $arr[$n]['x_type'] = $v;break;
  //                   case 1:
  //                       $arr[$n]['name'] = $v;break;
  //                   case 2:
  //                       $arr[$n]['content'] = $v;break;
  //                   case 3:
  //                       $arr[$n]['time'] = $v;break;
  //               }
  //               $map[$n][] = $v;
  //           }
  //       }
  //       // var_dump($arr);
  //       $data= array_values($arr);

  //       // dump($data);
  //       // exit;
       
  //       if ($Shen->addAll($data)>0) {
  //       	echo '1111';
  //       }else{
  //       	echo '2222';
  //       }


   





	}





  //费用申请添加
    public function yadd()
    {
        // dump($_POST);
        // exit;
        $arr = $_POST;
        // dump($dada);
        $z_id = M('auth_group_access')->where(array('uid'=>$_SESSION['uid']))->select();
        $dada = M('member')->where(array('uid'=>$_SESSION['uid']))->select();
        $b_id = $z_id[0]['group_id'];
        $m_list = M('auth_group')->where(array('id'=>$b_id))->select();

        // dump($m_list);
        // exit;
        $arr['ment'] = $m_list[0]['title'];
        $arr['uname'] = $dada[0]['user'];
        $arr['time'] = date('Y-m-d');
        $arr['sum'] = $_POST['sum'].'/元';
        $arr['set'] = $_POST['set'].'/张';
        if (M('cost')->add($arr) > 0) {
            echo '1111';
        }else{
            echo '2222';
        }


    }




    //考勤申请添加
    public function kadd()
    {
      dump($_POST);
      exit;
      $list['place'] = $_POST['place'];
      $list['content'] = $_POST['content'];
      $list['type'] = $_POST['type'];
      $list['day'] = $_POST['day'];
      $list['time']  = $_POST['k_time'].'至'.$_POST['e_time'];
      $list['s_time'] = date('Y-m-d');
      $z_id = M('auth_group_access')->where(array('uid'=>$_SESSION['uid']))->select();
      $dada = M('member')->where(array('uid'=>$_SESSION['uid']))->select();
      $b_id = $z_id[0]['group_id'];
      $m_list = M('auth_group')->where(array('id'=>$b_id))->select();

        // dump($m_list);
        // exit;
      $list['ment'] = $m_list[0]['title'];
      $list['uname'] = $dada[0]['user'];  


      // dump($list);
      if (M('leave')->add($list) > 0) {
          echo '1111';

       } else{
          echo '2222';
       }

    }









   






    







    





    //行政物资月度申请
    //
    public function yue()
    {
        if (IS_POST) {
            // $dd = date('d');
            // echo $dd;
            // exit;
          // dump(I());
          // exit;
            // 判断是否为申请日期
            // if (in_array(date('d'),[25,26,27,28])) { 
                  $dada = M('member')->where(array('uid'=>$_SESSION['uid']))->select();

            // dump($dada);
            $z_id = M('auth_group_access')->where(array('uid'=>$_SESSION['uid']))->select();
            
            $b_id = $z_id[0]['group_id'];
            $m_list = M('auth_group')->where(array('id'=>$b_id))->select();
           $slist = M('stock')->where(['id'=>$_POST['id']])->select();
            // dump($m_list);
            // exit;
            switch ($_POST['x_type']) {
              case '1':
                $arr['x_type'] = '办公用品';
                $date['wtype'] = '办公用品';
                break;
              case '2':
                $arr['x_type'] = '劳务用品';
                $date['wtype'] = '劳务用品';
                break;
              case '3':
                $arr['x_type'] = '招待用品';
                $date['wtype'] = '招待用品';
                break;
            }
           
            // dump($dada[0]['m_type']);
            // exit;
            switch ($dada[0]['m_type']) {
                  case '2':  //主管
                        // dump($_POST);
                        // exit;
                        if ($m_list[0]['post'] == '行政中心') {
                            
                            $arr['num'] = $slist[0]['num'];

                            $arr['com'] = $slist[0]['com'];
                            $arr['wname'] = $slist[0]['name'];
                            $arr['type'] = $_POST['type'];
                            $arr['unit'] = $slist[0]['unit'];
                            $arr['wid'] = $slist[0]['id'];
                            $arr['x_type'] = $slist[0]['x_type'];
                            // dump($arr['unit']);
                            // exit;
                            $arr['number'] = $slist[0]['number'];
                            $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                            $arr['ment'] = $m_list[0]['post'];
                            $arr['uname'] = $dada[0]['user'];
                            $arr['time'] = date('Y-m-d');
                            $arr['look'] = '8';  
                            if (M('look')->add($arr) > 0) {
                                $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                                $date['zname'] = $dada[0]['user'];
                                $date['ztype'] = $dada[0]['m_type'];
                                $date['type'] = $_POST['type'];
                                $date['stype'] = 1;
                                $date['ztime'] = date('Y-m-d');
                                $date['sid'] = $llist[0]['id'];
                                

                               if (M('yue')->add($date) > 0) {
                                     echo '1111';
                                } 

                            }else{
                                echo '2222';
                            }



                        }else{
                            if ($m_list[0]['post'] == '采购中心') {

                                
                                $arr['num'] = $_POST['num'];
                                $arr['com'] = $slist[0]['com'];
                                $arr['wname'] = $slist[0]['name'];
                                $arr['type'] = $_POST['type'];
                                $arr['unit'] = $slist[0]['unit'];
                                $arr['wid'] = $slist[0]['id'];
                                $arr['x_type'] = $slist[0]['x_type'];
                                // dump($arr['unit']);
                                // exit;
                                $arr['number'] = $slist[0]['number'];
                                $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                                $arr['ment'] = $m_list[0]['post'];
                                $arr['uname'] = $dada[0]['user'];
                                $arr['time'] = date('Y-m-d');
                                $arr['look'] = '9';
                               
                                if (M('look')->add($arr) > 0) {
                                    $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                                //   
                                    $date['zname'] = $dada[0]['user'];
                                    $date['ztype'] = $dada[0]['m_type'];
                                    $date['stype'] = 1;
                                    $date['ztime'] = date('Y-m-d');
                                    $date['sid'] = $llist[0]['id'];
                                //      dump($date);
                                // exit;

                                   if (M('yue')->add($date) > 0) {
                                         echo '1111';
                                    } 

                                }else{
                                    echo '2222';
                                }


                              
                            }else{
                                if ($m_list[0]['post'] == '财务中心') {
                                    
                                     $arr['num'] = $_POST['num'];
                                    $arr['com'] = $slist[0]['com'];
                                    $arr['wname'] = $slist[0]['name'];
                                    $arr['type'] = $_POST['type'];
                                    $arr['unit'] = $slist[0]['unit'];
                                    $arr['wid'] = $slist[0]['id'];
                                    $arr['x_type'] = $slist[0]['x_type'];
                                    // dump($arr['unit']);
                                    // exit;
                                    $arr['number'] = $slist[0]['number'];
                                    $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                                    $arr['ment'] = $m_list[0]['post'];
                                    $arr['uname'] = $dada[0]['user'];
                                    $arr['time'] = date('Y-m-d'); 
                                    $arr['look'] = '10'; 
                                    if (M('look')->add($arr) > 0) {
                                        $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                                        $date['zname'] = $dada[0]['user'];
                                        $date['ztype'] = $dada[0]['m_type'];
                                        $date['stype'] = 1;
                                        $date['ztime'] = date('Y-m-d');
                                        $date['sid'] = $llist[0]['id'];
                                      

                                       if (M('yue')->add($date) > 0) {
                                             echo '1111';
                                        } 

                                    }else{
                                        echo '2222';
                                    }
                                }else{
                                  // echo '12';
                                  // exit;
                                    
                                        $arr['num'] = $_POST['num'];
                                        $arr['com'] = $slist[0]['com'];
                                        $arr['wname'] = $slist[0]['name'];
                                        $arr['type'] = $_POST['type'];
                                        $arr['unit'] = $slist[0]['unit'];
                                        $arr['wid'] = $slist[0]['id'];
                                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                                        $arr['number'] = $slist[0]['number'];
                                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                                        $arr['ment'] = $m_list[0]['post'];
                                        $arr['uname'] = $dada[0]['user'];
                                        $arr['time'] = date('Y-m-d'); 
                                        $arr['look'] = '1';  
                                    if (M('look')->add($arr) > 0) {
                                        $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                                        $date['zname'] = $dada[0]['user'];
                                        $date['ztype'] = $dada[0]['m_type'];
                                        $date['stype'] = 1;
                                        $date['ztime'] = date('Y-m-d');
                                        $date['sid'] = $llist[0]['id'];
                                      

                                       if (M('yue')->add($date) > 0) {
                                             echo '1111';
                                        } 

                                    }else{
                                        echo '2222';
                                    }
                                }
                            }
                        }
                    break;
                  case '3':  //经理
                      // echo '111';
                      // exit;
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d'); 
                       
                        $arr['look'] = '2';
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['jtime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                      

                          if (M('yue')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;
                  case '4':  //行政
                      
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');    
                        $arr['look'] = '8';
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['zname'] = $dada[0]['user'];
                          $date['ztype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['ztime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
             

                          if (M('yue')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;
                  case '5':   //财务
                       
                       $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');    
                        $arr['look'] = '10'; 
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['zname'] = $dada[0]['user'];
                          $date['ztype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['ztime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                    
                          if (M('yue')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;

                  case '10':   //财务
                       
                       $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');    
                        $arr['look'] = '10'; 
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['zname'] = $dada[0]['user'];
                          $date['ztype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['ztime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                    
                          if (M('yue')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;


                  case '8':   //职能总
                      
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');   
                        $arr['look'] = '2'; 
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['jtime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                  

                          if (M('yue')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;
                  case '9':   //网络总
                      
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d');   
                        $arr['look'] = '2'; 
                      if (M('look')->add($arr) > 0) {
                          $llist = M('look')->where(['uname'=>$arr['uname']])->order('id desc')->limit(1)->select();
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['jtime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                

                          if (M('yue')->add($date) > 0) {
                                echo '1111';
                          } 

                      }else{
                          echo '2222';
                      }
                    break;
                case '0':
                        $arr['num'] = $_POST['num'];
                        $arr['com'] = $slist[0]['com'];
                        $arr['wname'] = $slist[0]['name'];
                        $arr['type'] = $_POST['type'];
                        $arr['unit'] = $slist[0]['unit'];
                        $arr['wid'] = $slist[0]['id'];
                        $arr['x_type'] = $slist[0]['x_type'];
                                        // dump($arr['unit']);
                                        // exit;
                        $arr['number'] = $slist[0]['number'];
                        $arr['zong'] = $slist[0]['unit'] * $_POST['num'] ;
                        $arr['ment'] = $m_list[0]['post'];
                        $arr['uname'] = $dada[0]['user'];
                        $arr['time'] = date('Y-m-d'); 
                      // dump($list);
                      // exit;
                     if (M('look')->add($arr) > 0) {
                          echo '1111';
                      }else{
                          echo '2222';
                      }
                    break;
            // }else{    //日期结尾
              
            //   echo '3333';
            //   exit;


            }



          //   }else{
          //     echo '4444';
              
          //   }  //日期开始
          // // $ku = M('stock')->where(['id'=>$_POST['id']])->find();
          // // if ($_POST['num'] > $ku['number']) {
          // //           echo '3333';
          // //           exit;
          // //         }
            
          //      exit;

        }else{
            $blist = M('stock')->where(['x_type'=>1])->select(); //办公用品
            $llist = M('stock')->where(['x_type'=>2])->select(); //劳保用品
            $zlist = M('stock')->where(['x_type'=>3])->select(); //招待用品
            // $gblist = M('stock')->where(['type'=>2,'x_type'=>1])->select(); //办公用品
            // $gllist = M('stock')->where(['type'=>2,'x_type'=>2])->select(); //劳保用品
            // $gzlist = M('stock')->where(['type'=>2,'x_type'=>3])->select(); //招待用品
            // dump($gblist);
            // exit;
            $this->assign('blist',$blist) ;  
            $this->assign('llist',$llist) ;
            $this->assign('zlist',$zlist) ;
              // $this->assign('list',$list) ;
            $this->display();
        }




    }










    public function ydshen()
    {
      // dump(I());
      // exit;
    }




    //物资名搜索
    public function sou()
    {
          // dump(I());
          $list = $_POST;
          $wname = $list['wname'];
          // dump($list);
          // exit;
    
          $data['name']= array('like','%'.$wname.'%');
          $cname['name']= array('like','%'.$wname.'%');
          $data['x_type'] = $list['x_type'];
          if (empty($wname)) {
            echo '1111';
            exit;
          }
          $wlist = M('stock')->where($cname)->select();
          if (!empty($wlist)) {
             $arr = M('stock')->where($data)->select();
              $this->ajaxReturn($arr);
          }else{
            echo '2222';
          }
     
        
        







    }




        //月度物资名搜索
    public function ysou()
    {
          // dump(I());
          $list = $_POST;
          $wname = $list['wname'];
          // dump($list);
          // exit;
    
          $data['name']= array('like','%'.$wname.'%');
          $cname['name']= array('like','%'.$wname.'%');
          $data['x_type'] = $list['x_type'];
          if (empty($wname)) {

            echo '1111';
            exit;
          }
          $wlist = M('stock')->where($cname)->select();
          if (!empty($wlist)) {
             $arr = M('stock')->where($data)->select();
              $this->ajaxReturn($arr);
          }else{
            echo '2222';
          }
     
     


    }











    //办公用品领用返回操作
    public function fan()
    {
      // dump(I());
      $lei = $_POST['lei'];
      switch ($lei) {
        case '1':
          $list = M('stock')->where(['x_type'=>1])->select();
            if (!empty($list)) {
              $this->ajaxReturn($list);
            }else{
              echo '1111';
            }
          break;
        case '2':
          $list = M('stock')->where(['x_type'=>2])->select();
            if (!empty($list)) {
              $this->ajaxReturn($list);
            }else{
              echo '1111';
            }
          break;
        case '3':
          $list = M('stock')->where(['x_type'=>3])->select();
            if (!empty($list)) {
              $this->ajaxReturn($list);
            }else{
              echo '1111';
            }
          break;
      }
    }
    //
    //
    //月度需求申请返回操作
    public function yfan()
    {
      // dump(I());
      $lei = $_POST['lei'];
      switch ($lei) {
        case '1':
          $list = M('stock')->where(['x_type'=>1])->select();
            if (!empty($list)) {
              $this->ajaxReturn($list);
            }else{
              echo '1111';
            }
          break;
        case '2':
          $list = M('stock')->where(['x_type'=>2])->select();
            if (!empty($list)) {
              $this->ajaxReturn($list);
            }else{
              echo '1111';
            }
          break;
        case '3':
          $list = M('stock')->where(['x_type'=>3])->select();
            if (!empty($list)) {
              $this->ajaxReturn($list);
            }else{
              echo '1111';
            }
          break;
      }
    }






    public function jix()
    {
      if (IS_POST) {


        $dada = M('member')->where(array('uid'=>$_SESSION['uid']))->select();
        $z_id = M('auth_group_access')->where(array('uid'=>$_SESSION['uid']))->select();
                
        $b_id = $z_id[0]['group_id'];
        $m_list = M('auth_group')->where(array('id'=>$b_id))->select();
        $slist = M('stock')->where(['id'=>$_POST['id']])->select();
        $list = $_POST;
        // foreach ($list as $value) {
        //     if (!empty($value)) {
        //         $arr[] = $value;
        //     }
        // }
        // dump($list);
        // exit;
        
        // $n = 0;
        // foreach ($list as $k => $v) {
        //     $result[$n][] = $v;
        //     if (($k + 1) % 6 == 0)
        //         $n++;
        //     // echo ($n+1) % 2;
        // }

        
        // dump($list);
        foreach ($list as $k => $v ){
           foreach ($v as $key => $value){
               if (!$value){
                   unset($list[$k][$key]);
                   continue;
               }
           }
           // if(empty($v)){
           //     unset($list[$k]);
           // }
        }
          $result = array_filter($list);
          // dump($result);
          // exit;
          switch ($dada[0]['m_type']) {
                  case '2':  //主管
                        // dump($_POST);
                        // exit;
                        if ($m_list[0]['post'] == '行政中心') {
                            
                           foreach ($result as  $value) {
                                       
                                        $value['time'] = date('Y-m-d');
                                        $value['ment'] = $m_list[0]['post'];
                                        $value['type'] = 1;
                                        $value['uname'] = $dada[0]['user'];
                                        $value['look'] = 8;
                                        $r[] = $value;              
                                      }
                                      $count = count($r);
                                    if (M('look')->addALL($r) > 0) {
                                        $llist = M('look')->where(['uname'=>$dada[0]['user']])->order('id desc')->limit($count)->select();
                                       foreach ($llist as  $v) {
                                          // dump($v);
                                          $date['zname'] = $dada[0]['user'];
                                          $date['ztype'] = $dada[0]['m_type'];
                                          $date['stype'] = 1;
                                          $date['ztime'] = date('Y-m-d');
                                          $date['sid'] = $v['id'];
                                          $date['wtype'] = '急性物品申购';
                                          // dump($date);
                                          $d[] = $date;
                                        }
                                        
                                        // exit;
                                       if (M('sh')->addALL($d) > 0) {
                                             $this->success('添加成功');
                                        } 

                                    }else{
                                       $this->error('添加失败');
                                    }



                        }else{
                            if ($m_list[0]['post'] == '采购中心') {

                                
                               foreach ($result as  $value) {
                     
                                        $value['time'] = date('Y-m-d');
                                        $value['ment'] = $m_list[0]['post'];
                                        $value['type'] = 1;
                                        $value['uname'] = $dada[0]['user'];
                                        $value['look'] = 9;
                                        $r[] = $value;      
                                      }
                                      $count = count($r);
                                    if (M('look')->addALL($r) > 0) {
                                        $llist = M('look')->where(['uname'=>$dada[0]['user']])->order('id desc')->limit($count)->select();
                                        foreach ($llist as  $v) {
                                          // dump($v);
                                          $date['zname'] = $dada[0]['user'];
                                          $date['ztype'] = $dada[0]['m_type'];
                                          $date['stype'] = 1;
                                          $date['ztime'] = date('Y-m-d');
                                          $date['sid'] = $v['id'];
                                          $date['wtype'] = '急性物品申购';
                                          // dump($date);
                                          $d[] = $date;
                                        }
                                        
                                        // exit;
                                       if (M('sh')->addALL($d) > 0) {
                                             $this->success('添加成功');
                                        } 

                                    }else{
                                       $this->error('添加失败');
                                    }


                              
                            }else{
                                if ($m_list[0]['post'] == '财务中心') {
                                    
                                    foreach ($result as  $value) {
                                        $value['time'] = date('Y-m-d');
                                        $value['ment'] = $m_list[0]['post'];
                                        $value['type'] = 1;
                                        $value['uname'] = $dada[0]['user'];
                                        $value['look'] = 10;
                                        $r[] = $value;                         
                                      }
                                      $count = count($r);
                                    if (M('look')->addALL($r) > 0) {
                                        $llist = M('look')->where(['uname'=>$dada[0]['user']])->order('id desc')->limit($count)->select();
                                        foreach ($llist as  $v) {
                                          // dump($v);
                                          $date['zname'] = $dada[0]['user'];
                                          $date['ztype'] = $dada[0]['m_type'];
                                          $date['stype'] = 1;
                                          $date['ztime'] = date('Y-m-d');
                                          $date['sid'] = $v['id'];
                                          $date['wtype'] = '急性物品申购';
                                          // dump($date);
                                          $d[] = $date;
                                        }
                                        
                                        // exit;
                                       if (M('sh')->addALL($d) > 0) {
                                             $this->success('添加成功');
                                        } 

                                    }else{
                                       $this->error('添加失败');
                                    }
                                }else{
                                  // echo '12';
                                  // exit;
                                    
                                      foreach ($result as  $value) {
                                       
                                      
                                       
                                        $value['time'] = date('Y-m-d');
                                        $value['ment'] = $m_list[0]['post'];
                                        $value['type'] = 1;
                                        $value['uname'] = $dada[0]['user'];
                                        $value['look'] = 1;
                                        $r[] = $value;                       
                                      }
                                        // echo  M("look")->fetchSql()->addALL($r);
                                        // exit;
                                        // foreach ($r as $valu) {
                                        //     if (!empty($valu)) {
                                        //         $e[] = $valu;
                                        //     }
                                        
                                        // // }
                                        $count = count($r);
                                        // dump($count);
                                        // exit;
                                    if (M('look')->addALL($r) > 0) {
                                        $llist = M('look')->where(['uname'=>$dada[0]['user']])->order('id desc')->limit($count)->select();
                                        // dump($llist);
                                        // exit;
                                        foreach ($llist as  $v) {
                                          // dump($v);
                                          $date['zname'] = $dada[0]['user'];
                                          $date['ztype'] = $dada[0]['m_type'];
                                          $date['stype'] = 1;
                                          $date['ztime'] = date('Y-m-d');
                                          $date['sid'] = $v['id'];
                                          $date['wtype'] = '急性物品申购';
                                          // dump($date);
                                          $d[] = $date;
                                        }
                                      

                                        // exit;
                                       if (M('sh')->addALL($d) > 0) {
                                             $this->success('添加成功');
                                        } 

                                    }else{
                                       $this->error('添加失败');
                                    }
                                }
                            }
                        }
                    break;
                  case '3':  //经理
                      // echo '111';
                      // exit;
                      foreach ($result as  $value) {
                        $value['time'] = date('Y-m-d');
                        $value['ment'] = $m_list[0]['post'];
                        $value['type'] = 1;
                        $value['uname'] = $dada[0]['user'];
                        $value['look'] = 2;
                        $r[] = $value;           
                      }
                      $count = count($r);
                      if (M('look')->addALL($r) > 0) {
                          $llist = M('look')->where(['uname'=>$dada[0]['user']])->order('id desc')->limit($count)->select();
                          foreach ($llist as  $v) {
                            // dump($v);
                            $date['jname'] = $dada[0]['user'];
                            $date['jtype'] = $dada[0]['m_type'];
                            $date['stype'] = 1;
                            $date['jtime'] = date('Y-m-d');
                            $date['sid'] = $v['id'];
                            $date['wtype'] = '急性物品申购';
                            // dump($date);
                            $d[] = $date;
                          }
                                        
                          // exit;
                          if (M('sh')->addALL($d) > 0) {
                                $this->success('添加成功');
                          } 

                      }else{
                          $this->error('添加失败');
                      }
                     
                    break;
                  case '4':  //行政
                      
                       foreach ($result as  $value) {
                        $value['time'] = date('Y-m-d');
                        $value['ment'] = $m_list[0]['post'];
                        $value['type'] = 1;
                        $value['uname'] = $dada[0]['user'];
                        $value['look'] = 8;
                        $r[] = $value;                          
                      }
                      $count = count($r);
                      if (M('look')->addALL($r) > 0) {
                          $llist = M('look')->where(['uname'=>$dada[0]['user']])->order('id desc')->limit($count)->select();
                          foreach ($llist as  $v) {
                            // dump($v);
                            $date['zname'] = $dada[0]['user'];
                            $date['ztype'] = $dada[0]['m_type'];
                            $date['stype'] = 1;
                            $date['ztime'] = date('Y-m-d');
                            $date['sid'] = $v['id'];
                            $date['wtype'] = '急性物品申购';
                            // dump($date);
                            $d[] = $date;
                          }
                                        
                          // exit;
                          if (M('sh')->addALL($d) > 0) {
                                $this->success('添加成功');
                          } 

                      }else{
                          $this->error('添加失败');
                      }
                    break;
                  case '5':   //财务
                       
                        foreach ($result as  $value) {
                        $value['time'] = date('Y-m-d');
                        $value['ment'] = $m_list[0]['post'];
                        $value['type'] = 1;
                        $value['uname'] = $dada[0]['user'];
                        $value['look'] = 10;
                        $r[] = $value;                          
                      }
                      $count = count($r);
                      if (M('look')->addALL($r) > 0) {
                          $llist = M('look')->where(['uname'=>$dada[0]['user']])->order('id desc')->limit($count)->select();
                          foreach ($llist as  $v) {
                            // dump($v);
                            $date['zname'] = $dada[0]['user'];
                            $date['ztype'] = $dada[0]['m_type'];
                            $date['stype'] = 1;
                            $date['ztime'] = date('Y-m-d');
                            $date['sid'] = $v['id'];
                            $date['wtype'] = '急性物品申购';
                            // dump($date);
                            $d[] = $date;
                          }
                                        
                          // exit;
                          if (M('sh')->addALL($d) > 0) {
                                $this->success('添加成功');
                          } 

                      }else{
                          $this->error('添加失败');
                      }
                    break;
                  case '8':   //职能总
                      
                      foreach ($result as  $value) {
                        $value['time'] = date('Y-m-d');
                        $value['ment'] = $m_list[0]['post'];
                        $value['type'] = 1;
                        $value['uname'] = $dada[0]['user'];
                        $value['look'] = 2;
                        $r[] = $value;                          
                      }
                      $count = count($r);
                      if (M('look')->addALL($r) > 0) {
                          $llist = M('look')->where(['uname'=>$dada[0]['user']])->order('id desc')->limit($count)->select();
                          foreach ($llist as  $v) {
                            // dump($v);
                            $date['jname'] = $dada[0]['user'];
                            $date['jtype'] = $dada[0]['m_type'];
                            $date['stype'] = 1;
                            $date['jtime'] = date('Y-m-d');
                            $date['sid'] = $v['id'];
                            $date['wtype'] = '急性物品申购';
                            // dump($date);
                            $d[] = $date;
                          }
                                        
                          // exit;
                          if (M('sh')->addALL($d) > 0) {
                                $this->success('添加成功');
                          } 

                      }else{
                          $this->error('添加失败');
                      }
                    break;
                  case '9':   //网络总
                      
                      foreach ($result as  $value) {
                        $value['time'] = date('Y-m-d');
                        $value['ment'] = $m_list[0]['post'];
                        $value['type'] = 1;
                        $value['uname'] = $dada[0]['user'];
                        $value['look'] = 2;
                        $r[] = $value;                          
                      }
                      
                      $count = count($r);
                      if (M('look')->addALL($r) > 0) {
                          $llist = M('look')->where(['uname'=>$dada[0]['user']])->order('id desc')->limit($count)->select();
                          foreach ($llist as  $v) {
                            // dump($v);
                            $date['jname'] = $dada[0]['user'];
                            $date['jtype'] = $dada[0]['m_type'];
                            $date['stype'] = 1;
                            $date['jtime'] = date('Y-m-d');
                            $date['sid'] = $v['id'];
                            $date['wtype'] = '急性物品申购';
                            // dump($date);
                            $d[] = $date;
                          }
                                        
                          // exit;
                          if (M('sh')->addALL($d) > 0) {
                                $this->success('添加成功');
                          } 

                      }else{
                          $this->error('添加失败');
                      }
                    break;
                case '0':
                // dump($result);
                // exit;
                      foreach ($result as  $value) {
                        $value['time'] = date('Y-m-d');
                        $value['ment'] = $m_list[0]['post'];
                        $value['type'] = 1;
                        $value['uname'] = $dada[0]['user'];
                        $value['look'] = 0;
                        $r[] = $value;                    
                      }
                      // dump($r);
                      // exit;
                     if (M('look')->addALL($r) > 0) {
                          $this->success('添加成功');
                      }else{
                          $this->error('添加失败');
                      }
                    break;
            }

             

              // dump($m_list);
              // exit;
              

      }else{
        $this->display();
      }
      
    }







    //办公用品月度需求审批模版
    public function yindex()
    {
    // dump($_GET);
    // $type = $_GET['type'];
    $gid = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    // dump($gid);
    // exit;
    $glist = M('auth_group')->where(['id'=>$gid[0]['group_id']])->select();
    // dump($glist);
    // exit;
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    $apost = $glist[0]['post'];
      // echo $apost;
      // exit;
    // dump($type);
    // exit;
    // 
      if ($glist[0]['title'] == '超级管理员') {
              $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(['type'=>3])->count();
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(['type'=>3])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门月度申请审批';
                  $this->assign('list',$list);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
        exit;
      }

        switch ($ulist[0]['m_type']) {
          case '2':   //主管
              $db = M("look");
              // echo '111';
              // exit;
                  // $where = "a_id=".$uid;
                  $count = $db->where(['type'=>3,'look'=>0,'ment'=>$apost,'ju'=>0])->count();
                  // dump($apost);
                  // exit;
                  $pagecount = 9;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(['type'=>3,'look'=>0,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门月度申请审批';
                  $this->assign('list',$list);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;



          case '3':   //经理


              switch ($apost) {
                case '行政中心':
                    $db = M("look");
                    // echo '111';
                    // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(['look'=>8,'type'=>3,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>8,'type'=>3,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门月度申请审批';


                        //---------------------------------------
                       
                      $lei = '行政';
                      $cao = 1;//行政操作分类
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                        $this->assign('cao',$cao);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                    $this->display('Shenp/jyue');
                  break;

                case '采购中心':
                    $db = M("look");
                    // echo '111';
                    // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(['look'=>9,'type'=>3,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>9,'type'=>3,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门月度申请审批';


                        //---------------------------------------
                       
                    
                        $this->assign('list',$list);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                    $this->display('Shenp/jyue');
                  break;
                case '财务中心':
                    $db = M("look");
                    
                        $count = $db->where(['look'=>10,'type'=>3,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>10,'type'=>3,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门月度申请审批';


                        //---------------------------------------
                       
                      $lei = '财务';
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                    $this->display('Shenp/jyue');
                  break;
                
                
              }





              
            break;
          case '4':  //行政
              $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>2,'ju'=>0))->count();
                  $pagecount = 9;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first'); 
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>2,'ju'=>0))->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门月度申请审批';
            //       $Model = M('look');//或者 $Model = D(); 或者 $Model = M();
              // $sql = "SELECT * FROM oa_look WHERE `num` > `number` AND `type` = 3 AND `look` = 2 AND `ju` = 0 ";
              // $voList = $Model->query($sql);
              // dump($list);
              // exit;
              $ylist = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>2,'ju'=>0))->select();
              foreach ($ylist as  $v) {
                $coun += $v['zong']; 
              }
              $title = '无库存月度需求申请';
            

              
                  $lei = 1;
                  $dao = 3;
                 
              

                  $cao = 1;//行政操作分类
              $this->assign('cao',$cao);
                  $this->assign('list',$list);
                  $this->assign('coun',$coun);
                  $this->assign('dao',$dao);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;

        

          case '5':  //财务
              $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>3,'ju'=>0))->count();
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>3,'ju'=>0))->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '公司月度需求审批';
                  $lei = 1;
                  $ylist = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>3,'ju'=>0))->select();
              foreach ($ylist as  $v) {
                $coun += $v['zong']; 
              }
              $this->assign('coun',$coun);
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;



          case '9':  //职能总经理
              $db = M("look");
              $mlist = M('auth_group')->where(['mtype'=>2])->select();

              foreach ($mlist as $vn) {
            
                $ments[] =  $vn['title'];
              

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>3,
                      'ju'   => 0

                  ];

                
                  $count = $db->where($where)->count();
                  
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where($where)->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门月度申请审批';
                  $lei = '总经理';
                
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display('Shenp/jyue');
            break;




          case '8':  //网络中心总经理
              $db = M("look");
              $mlist = M('auth_group')->where(['mtype'=>1])->select();

              foreach ($mlist as $vn) {
              // echo $v['n_id'];
              // exit;
              // $ment .= "`ment`="."'".$vn['title']."'"." or ";
              // $ment .= "'".$vn['title']."'"." , ";
                $ments[] =  $vn['title'];
                // 

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>3,
                      'ju'   => 0

                  ];

                  // dump($where);
                  // exit;
                  // $where = "a_id=".$uid;
                  $count = $db->where($where)->count();
                  // dump($count);
                  // exit;
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where($where)->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门月度申请审批';
                  // $lei = 1;
                  // $alist = M('look')->order('ment desc')->select();
                  // dump($alist);
                  // exit;
                  // $b = 0;
                  // foreach ($list as  $v) {
                  //  $b += $v['']
                  // }
                  // field()
                  $this->assign('list',$list);
                  // $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;


          case '6':  //董事办
              $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(['type'=>3,'look'=>5,'ju'=>0])->count();
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(['type'=>3,'look'=>5,'ju'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '公司月度汇总审批';
                  $lei = 1;
                  // $alist = M('look')->order('ment desc')->select();
                  // dump($list);
                  // exit;
                  // $b = 0;
                  // foreach ($list as  $v) {
                  //  $b += $v['']
                  // }
                  // field()
                  $ylist = $db->where(['type'=>3,'look'=>5,'ju'=>0])->select();
              foreach ($ylist as  $v) {
                $coun += $v['zong']; 
              }
              $this->assign('coun',$coun);
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;

          }
    }







    //办公用品领用审批模版
    public function bindex()
    {
          $gid = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
          // dump($gid);
          // exit;
          $glist = M('auth_group')->where(['id'=>$gid[0]['group_id']])->select();
          // $title = substr($glist[0]['title'], 0,2);
          // dump($glist);
          // exit;
          $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();



          if ($glist[0]['title'] == '超级管理员') {
              $x_list = M('look')->where(['type'=>['in',array(0,2)]])->order('time desc')->limit(5)->select();
              $y_list = M('cost')->order('time desc')->limit(5)->select();
              $this->assign('x_list',$x_list);
              $this->assign('y_list',$y_list);
              $this->display();
              exit;
          }
          switch ($ulist[0]['m_type']) {
            case '2':   //主管
              $db = M("look");
              $apost = $glist[0]['post'];
              // $x_list = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->select();
              $count = $db->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->count();
              // dump($count);
              // exit;
              $pagecount = 10;
              $page = new \Think\Page($count , $pagecount);
              // $row[] = '';
              $page->parameter = $row; //此处的row是数组，为了传递查询条件
              $page->setConfig('first');
              $page->setConfig('prev','上一页');
              $page->setConfig('next','下一页');
              $page->setConfig('last','尾页');
              $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
              $show = $page->show();
              $list = $db->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
              $xnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
              $gnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
              $jnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
              // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
              $this->assign('x_list',$list);
              $this->assign('page',$show);
              $this->assign('xnum',$xnum);
              $this->assign('gnum',$gnum);
              $this->assign('jnum',$jnum);
              // $this->assign('y_list',$y_list);
              $this->display();
              break;
            case '3':  //经理
              // dump($glist);
              //    exit;
              switch ($glist[0]['post']) {
                case '行政中心':
                  $apost = $glist[0]['post'];
                  $apost = $glist[0]['post'];
                  $x_list = M('look')->where(['look'=>2,'ju'=>0,'type'=> 0])->order('id DESC')->limit(5)->select();
                  $xnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                  $gnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                  $jnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                  // $y_list = M('cost')->where(['look'=>0,'ju'=>0,])->order('id DESC')->limit(5)->select();
                  
                  $this->assign('xnum',$xnum);
                  $this->assign('gnum',$gnum);
                  $this->assign('jnum',$jnum);
                  $this->assign('x_list',$x_list);
                  $this->assign('type',$type);
                  $this->assign('y_list',$y_list);
                  $this->display();
                  break;
                case '采购中心':
                  $apost = $glist[0]['post'];
                  $x_list = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->limit(5)->select();
                  $xnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                  $gnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                  $jnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                  // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                  
                  $this->assign('xnum',$xnum);
                  $this->assign('gnum',$gnum);
                  $this->assign('jnum',$jnum);
                  // $y_list = M('cost')->where(['look'=>9,'ju'=>0])->order('id DESC')->limit(5)->select();
                  $this->assign('x_list',$x_list);
                  $this->assign('y_list',$y_list);
                  $this->display();
                  break;
                case '财务中心':
                  $apost = $glist[0]['post'];
                  $x_list = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->limit(5)->select();
                  $xnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                  $gnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                  $jnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                  // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                  
                  $this->assign('xnum',$xnum);
                  $this->assign('gnum',$gnum);
                  $this->assign('jnum',$jnum);
                  // $y_list = M('cost')->where(['look'=>10,'ju'=>0])->order('id DESC')->limit(5)->select();
                  $this->assign('x_list',$x_list);
                  $this->assign('y_list',$y_list);
                  $this->display();
                  break;
                
                
              }
              break;
            case '4':   //行政
              $db = M("look");
              $apost = $glist[0]['post'];
              // $x_list = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->select();
              $count = $db->where(['look'=>2,'ju'=>0,'type'=>0])->count();
              // dump($count);
              // exit;
              $pagecount = 10;
              $page = new \Think\Page($count , $pagecount);
              // $row[] = '';
              $page->parameter = $row; //此处的row是数组，为了传递查询条件
              $page->setConfig('first');
              $page->setConfig('prev','上一页');
              $page->setConfig('next','下一页');
              $page->setConfig('last','尾页');
              $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
              $show = $page->show();
              $list = $db->where(['look'=>2,'ju'=>0,'type'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
              // dump($list);
              // exit;
              $xnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>2,'type'=>0])->count();
              $gnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>1,'type'=>0])->count();
              $jnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>3,'type'=>0])->count();
              // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
              $this->assign('x_list',$list);
              $this->assign('page',$show);
              $this->assign('xnum',$xnum);
              $this->assign('gnum',$gnum);
              $this->assign('jnum',$jnum);
              // $this->assign('y_list',$y_list);
              $this->display();
              break;
            
            case '8':  //总经理(网)
              // $apost = $glist[0]['post'];
              $mlist = M('auth_group')->where(['mtype'=>1])->select();

              foreach ($mlist as $vn) {
              // echo $v['n_id'];
              // exit;
              // $ment .= "`ment`="."'".$vn['title']."'"." or ";
              // $ment .= "'".$vn['title']."'"." , ";
              $ments[] =  $vn['title'];
                // 

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>0,
                      'ju'   => 0

                  ];

          //          dump($where);
              // exit;
              // $ments = $ment."`look`= 1"." "."or"." "."`ju`= 0";
              
              
              // $ment = "(".rtrim($ment,'or ').")"."AND"."("."`look`= 1"." "."AND"." "."`ju`= 0".")";
              
              // $ment =rtrim($ment,', ');
              // echo $ment;
              // exit;
              $x_list =  M('look')->where($where)->order('id DESC')->limit(5)->select();
              $xnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>2,'type'=>0])->count();
              $gnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>1,'type'=>0])->count();
              $jnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>3,'type'=>0])->count();
                  // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                  
              $this->assign('xnum',$xnum);
              $this->assign('gnum',$gnum);
              $this->assign('jnum',$jnum);
              // $x_list = "SELECT * FROM oa_look where ment in($ment) AND (`look`= 1 AND `ju`=0)";
              // dump($x_list);
              // exit;
              // $y_list = M('cost')->where(['look'=>1,'ju'=>0,'ment'=>$ment])->order('id DESC')->limit(5)->select();
              $type = 'wang';
              $this->assign('type',$type);
              $this->assign('x_list',$x_list);
              $this->assign('y_list',$y_list);
              $this->display();
              break;
            case '9':  //总经理(职)
              // $apost = $glist[0]['post'];
              $mlist = M('auth_group')->where(['mtype'=>2])->select();
              // dump($mlist);
              // exit;
              foreach ($mlist as $vn) {
              // echo $v['n_id'];
              // exit;
              // $ment .= "`ment`="."'".$vn['title']."'"." or ";
              // $ment .= "'".$vn['title']."'"." , ";
                $ments[] =  $vn['title'];
                // 

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>  0,
                      'ju'   => 0

                  ];

         
              $db = M("look");
              $count = $db->where($where)->count();
              $pagecount = 10;
              $page = new \Think\Page($count , $pagecount);
              // $row[] = '';
              $page->parameter = $row; //此处的row是数组，为了传递查询条件
              $page->setConfig('first');
              $page->setConfig('prev','上一页');
              $page->setConfig('next','下一页');
              $page->setConfig('last','尾页');
              $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
              $show = $page->show();
              $list = $db->where($where)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
              $xnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>2,'type'=>0])->count();
              $gnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>1,'type'=>0])->count();
              $jnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>3,'type'=>0])->count();
                  // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                  
              $this->assign('xnum',$xnum);
              $this->assign('gnum',$gnum);
              $this->assign('jnum',$jnum);
              // $x_list = "SELECT * FROM oa_look where ment in($ment) AND (`look`= 1 AND `ju`=0)";
              // dump($x_list);
              // exit;
              // $y_list = M('cost')->where(['look'=>1,'ju'=>0,'ment'=>$ment])->order('id DESC')->limit(5)->select();
              $type = 'zhi';
              $this->assign('type',$type);
              $this->assign('x_list',$list);
              $this->assign('page',$show);
              // $this->assign('y_list',$y_list);
              $this->display();
              break;
            


            
          }

    }




    //办公用品领用审批分类
    public function fenlei()
    {
              $type = $_GET['type'];
              $gid = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
              
              $glist = M('auth_group')->where(['id'=>$gid[0]['group_id']])->select();
              
              $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
              $apost = $glist[0]['post'];
              
              switch ($type) {
                case '1': //办公用品分类

                  switch ($ulist[0]['m_type']) {
                    case '2':   //主管
                        $db = M("look");
                            // $where = "a_id=".$uid;
                            $count = $db->where(['x_type'=>1,'look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->count();
                            $pagecount = 9;
                            $page = new \Think\Page($count , $pagecount);
                            // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->where(['x_type'=>1,'look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '部门办公用品领用审批';
                            $xnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                        // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                        
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('list',$list);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                            $this->display();
                      break;
                    case '3':  //经理/总监
                        switch ($glist[0]['post']) {
                          case '行政中心':
                            $apost = $glist[0]['post'];
                            // $x_list = M('look')->where(['look'=>8,'ju'=>0,'type'=>2])->order('id DESC')->select();
                            // $y_list = M('cost')->where(['look'=>8,'ju'=>0])->order('id DESC')->select();
                            $db = M("look");
                            $type = 'xing';
                            $title = '部门办公用品领用审批';
                            $count = $db->where(['look'=>2,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                                $pagecount = 10;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where(['look'=>2,'ju'=>0,'x_type'=>1,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                                $xnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                            $this->assign('list',$list);
                            $this->assign('type',$type);
                            // $this->assign('y_list',$y_list);
                            $this->display();
                            break;
                          case '采购中心':
                            $apost = $glist[0]['post'];
                            // $x_list = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'type'=>2])->order('id DESC')->select();
                            // $y_list = M('cost')->where(['look'=>9,'ju'=>0])->order('id DESC')->select();
                            $db = M("look");
                            $count = $db->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                                $pagecount = 10;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $this->assign('page',$show);
                            $title = '部门办公用品领用审批';
                            $xnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('title',$title);
                            $this->assign('list',$list);
                            // $this->assign('y_list',$y_list);
                            $this->display();
                            break;
                          case '财务中心':
                            $apost = $glist[0]['post'];
                            // $x_list = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'type'=>2])->order('id DESC')->limit(5)->select();
                            // $y_list = M('cost')->where(['look'=>10,'ju'=>0])->order('id DESC')->limit(5)->select();
                            $db = M("look");
                            $count = $db->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                                $pagecount = 9;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                                $xnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('page',$show);
                            $title = '部门办公用品领用审批';
                            $this->assign('title',$title);
                            $this->assign('list',$list);
                            // $this->assign('y_list',$y_list);
                            $this->display();
                            break;
                          
                          
                        }   
                      break;
                    

                    case '4':   //行政
                        $db = M("look");
                            // $where = "a_id=".$uid;
                            $count = $db->where(['x_type'=>1,'look'=>2,'ju'=>0,'type'=>0])->count();
                            $pagecount = 9;
                            $page = new \Think\Page($count , $pagecount);
                            // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->where(['x_type'=>1,'look'=>2,'ju'=>0,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '公司办公用品领用审批';
                            $xnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            // dump($list);
                            // exit;
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('list',$list);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                            $this->display();
                      break;
                    

                    case '8':  //总经理(网)
                        // $apost = $glist[0]['post'];
                        $mlist = M('auth_group')->where(['mtype'=>1])->select();

                        foreach ($mlist as $vn) {
                        // echo $v['n_id'];
                        // exit;
                        // $ment .= "`ment`="."'".$vn['title']."'"." or ";
                        // $ment .= "'".$vn['title']."'"." , ";
                          $ments[] =  $vn['title'];
                          // 

                        }
                         $where = [
                                'ment' => [
                                    'in',
                                    $ments
                                ],
                                'look' => 1,
                                'x_type'=> 1,
                                'type'=>0 ,
                                'ju'   => 0

                            ];

                    //          dump($where);
                        // exit;
                        // $ments = $ment."`look`= 1"." "."or"." "."`ju`= 0";
                        
                        
                        // $ment = "(".rtrim($ment,'or ').")"."AND"."("."`look`= 1"." "."AND"." "."`ju`= 0".")";
                        
                        // $ment =rtrim($ment,', ');
                        // echo $ment;
                        // exit;
                        // $x_list =  M('look')->where($where)->order('id DESC')->limit(5)->select();
                        // $x_list = "SELECT * FROM oa_look where ment in($ment) AND (`look`= 1 AND `ju`=0)";
                        // dump($x_list);
                        // exit;
                        // $y_list = M('cost')->where(['x_type'=>2,'look'=>1,'ju'=>0,'ment'=>$ment])->order('id DESC')->limit(5)->select();
                            $db = M("look");
                            $count = $db->where($where)->count();
                                $pagecount = 9;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where($where)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $this->assign('page',$show);
                            $title = '部门办公用品领用审批';
                        $xnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                        $this->assign('xnum',$xnum);
                        $this->assign('gnum',$gnum);
                        $this->assign('jnum',$jnum);
                        $this->assign('title',$title);
                        $this->assign('x_list',$list);
                        // $this->assign('y_list',$y_list);
                        $this->display();
                        break;
                    case '9':  //总经理(职)
                        // $apost = $glist[0]['post'];
                        $mlist = M('auth_group')->where(['mtype'=>2])->select();
                        // dump($mlist);
                        // exit;
                        foreach ($mlist as $vn) {
                        // echo $v['n_id'];
                        // exit;
                        // $ment .= "`ment`="."'".$vn['title']."'"." or ";
                        // $ment .= "'".$vn['title']."'"." , ";
                          $ments[] =  $vn['title'];
                          // 

                        }
                         $where = [
                                'ment' => [
                                    'in',
                                    $ments
                                ],
                                'look' => 1,
                                'x_type'=> 1,
                                'type'=>0,
                                'ju'   => 0

                            ];

                    
                            $db = M("look");
                            $count = $db->where($where)->count();
                            // dump($count);
                            // exit;
                                $pagecount = 9;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where($where)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $xnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                        $this->assign('xnum',$xnum);
                        $this->assign('gnum',$gnum);
                        $this->assign('jnum',$jnum);
                        $title = '部门办公用品领用审批';
                        $this->assign('title',$title);
                        $this->assign('list',$list);
                        $this->assign('page',$show);
                        // $this->assign('y_list',$y_list);
                        $this->display();
                      break;



                    


                    
                  }
                  
                    
                  break;




                case '2': //劳保用品分类
                  switch ($ulist[0]['m_type']) {
                    case '2':   //主管
                        $db = M("look");
                            // $where = "a_id=".$uid;
                            $count = $db->where(['x_type'=>2,'look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->count();
                            $pagecount = 9;
                            $page = new \Think\Page($count , $pagecount);
                            // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->where(['x_type'=>2,'look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '部门劳保用品领用审批';
                            $xnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('list',$list);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                        $this->display();
                      break;
                    case '3':  //经理/总监
                        switch ($glist[0]['post']) {
                          case '行政中心':
                            $apost = $glist[0]['post'];
                            // $x_list = M('look')->where(['look'=>8,'ju'=>0,'type'=>0])->order('id DESC')->limit(5)->select();
                            // $y_list = M('cost')->where(['look'=>8,'ju'=>0])->order('id DESC')->limit(5)->select();
                            $db = M("look");
                                // $where = "a_id=".$uid;
                                $count = $db->where(['look'=>8,'ju'=>0,'ment'=>$apost,'x_type'=>2,'type'=>0])->count();
                                $pagecount = 9;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where(['look'=>8,'ju'=>0,'ment'=>$apost,'x_type'=>2,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $type = 'xing';
                            $title = '部门劳保用品领用审批';
                            $xnum = M('look')->where(['look'=>8,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>8,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>8,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('title',$title);
                            $this->assign('list',$list);
                            $this->assign('type',$type);
                            $this->assign('page',$show);
                            // $this->assign('y_list',$y_list);
                            $this->display();
                            break;
                          case '采购中心':
                            $apost = $glist[0]['post'];
                            // $x_list = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->limit(5)->select();
                            // $y_list = M('cost')->where(['look'=>9,'ju'=>0])->order('id DESC')->limit(5)->select();
                            // 
                            $db = M("look");
                                // $where = "a_id=".$uid;
                                $count = $db->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                                $pagecount = 9;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                                $xnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $title = '部门劳保用品领用审批';
                            $this->assign('title',$title);
                            $this->assign('list',$list);
                            $this->assign('page',$show);
                            // $this->assign('y_list',$y_list);
                            $this->display();
                            break;
                          case '财务中心':
                            $apost = $glist[0]['post'];
                            // $x_list = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->limit(5)->select();
                            // $y_list = M('cost')->where(['look'=>10,'ju'=>0])->order('id DESC')->limit(5)->select();
                            $db = M("look");
                                // $where = "a_id=".$uid;
                                $count = $db->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                                $pagecount = 9;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '部门劳保用品领用审批';
                            $xnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('title',$title);
                            $this->assign('list',$x_list);
                            $this->assign('page',$show);
                            // $this->assign('y_list',$y_list);
                            $this->display();
                            break;
                          
                          
                        }
                      break;
                    case '4':   //行政
                        $db = M("look");
                            // $where = "a_id=".$uid;
                            $count = $db->where(['x_type'=>2,'look'=>2,'ju'=>0,'type'=>0])->count();
                            $pagecount = 9;
                            $page = new \Think\Page($count , $pagecount);
                            // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->where(['x_type'=>2,'look'=>2,'ju'=>0,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '部门劳保用品领用审批';
                            $xnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('list',$list);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                        $this->display();
                      break;
                    case '8':  //总经理(网)
                        // $apost = $glist[0]['post'];
                        $mlist = M('auth_group')->where(['mtype'=>1])->select();

                        foreach ($mlist as $vn) {
                        // echo $v['n_id'];
                        // exit;
                        // $ment .= "`ment`="."'".$vn['title']."'"." or ";
                        // $ment .= "'".$vn['title']."'"." , ";
                          $ments[] =  $vn['title'];
                          // 

                        }
                         $where = [
                                'ment' => [
                                    'in',
                                    $ments
                                ],
                                'look' => 1,
                                'x_type'=>2,
                                'type'=>0,
                                'ju'   => 0

                            ];

                   
                        $db = M("look");
                                // $where = "a_id=".$uid;
                        $count = $db->where($where)->count();
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where($where)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        // $x_list = "SELECT * FROM oa_look where ment in($ment) AND (`look`= 1 AND `ju`=0)";
                        // dump($x_list);
                        // exit;
                        // $y_list = M('cost')->where(['x_type'=>0,'look'=>1,'ju'=>0,'ment'=>$ment])->order('id DESC')->limit(5)->select();
                        $title = '部门劳保用品领用审批';
                        $xnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                        $this->assign('xnum',$xnum);
                        $this->assign('gnum',$gnum);
                        $this->assign('jnum',$jnum);
                        $this->assign('title',$title);
                        $this->assign('list',$list);
                        $this->assign('page',$show);
                        // $this->assign('y_list',$y_list);
                        $this->display();
                        break;
                    case '9':  //总经理(职)
                        // $apost = $glist[0]['post'];
                        $mlist = M('auth_group')->where(['mtype'=>2])->select();
                        // dump($mlist);
                        // exit;
                        foreach ($mlist as $vn) {
                        // echo $v['n_id'];
                        // exit;
                        // $ment .= "`ment`="."'".$vn['title']."'"." or ";
                        // $ment .= "'".$vn['title']."'"." , ";
                          $ments[] =  $vn['title'];
                          // 

                        }
                         $where = [
                                'ment' => [
                                    'in',
                                    $ments
                                ],
                                'look' => 1,
                                'x_type'=>  2,
                                'type'=>0,
                                'ju'   => 0

                            ];

                        $db = M("look");
                                // $where = "a_id=".$uid;
                        $count = $db->where($where)->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where($where)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        
                        $title = '部门劳保用品领用审批';
                        $xnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                        $this->assign('xnum',$xnum);
                        $this->assign('gnum',$gnum);
                        $this->assign('jnum',$jnum);
                        $this->assign('title',$title);
                        $this->assign('list',$list);
                        $this->assign('page',$show);
                        // $this->assign('y_list',$y_list);
                        $this->display();
                      break;
                    


                    
                  }
                  

                  break;



                case '3':  //招待用品分类
                  switch ($ulist[0]['m_type']) {
                    case '2':   //主管
                        $db = M("look");
                            // $where = "a_id=".$uid;
                            $count = $db->where(['x_type'=>3,'look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->count();
                            $pagecount = 9;
                            $page = new \Think\Page($count , $pagecount);
                            // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->where(['x_type'=>3,'look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '部门招待用品领用审批';
                            $xnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                        $this->assign('xnum',$xnum);
                        $this->assign('gnum',$gnum);
                        $this->assign('jnum',$jnum);
                            $this->assign('list',$list);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                        $this->display();
                      break;
                    case '3':  //经理/总监
                        switch ($glist[0]['post']) {
                          case '行政中心':
                            $apost = $glist[0]['post'];
                            // $x_list = M('look')->where(['look'=>8,'ju'=>0,'type'=>1])->order('id DESC')->limit(5)->select();
                            // $y_list = M('cost')->where(['look'=>8,'ju'=>0])->order('id DESC')->limit(5)->select();
                            $db = M("look");
                                // $where = "a_id=".$uid;
                                $count = $db->where(['look'=>8,'ju'=>0,'ment'=>$apost,'x_type'=>3,'type'=>0])->count();
                                $pagecount = 9;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where(['look'=>8,'ju'=>0,'ment'=>$apost,'x_type'=>3,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $this->assign('page',$show);
                            $type = 'xing';
                            $title = '部门招待用品领用审批';
                            $xnum = M('look')->where(['look'=>8,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>8,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>8,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('title',$title);
                            $this->assign('list',$list);
                            $this->assign('type',$type);
                            // $this->assign('y_list',$y_list);
                            $this->display();
                            break;
                          case '采购中心':
                            $apost = $glist[0]['post'];
                            // $x_list = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'type'=>1])->order('id DESC')->limit(5)->select();
                            // $y_list = M('cost')->where(['look'=>9,'ju'=>0])->order('id DESC')->limit(5)->select();
                            // 
                            $db = M("look");
                                // $where = "a_id=".$uid;
                                $count = $db->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                                $pagecount = 9;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $this->assign('page',$show);
                            $title = '部门招待用品领用审批';
                            $xnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>9,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('title',$title);
                            $this->assign('list',$x_list);
                            // $this->assign('y_list',$y_list);
                            $this->display();
                            break;
                          case '财务中心':
                            $apost = $glist[0]['post'];
                            // $x_list = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'type'=>1])->order('id DESC')->limit(5)->select();
                            $db = M("look");
                                // $where = "a_id=".$uid;
                                $count = $db->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                                $pagecount = 9;
                                $page = new \Think\Page($count , $pagecount);
                                // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $this->assign('page',$show);
                            $title = '部门招待用品领用审批';
                            $xnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                            $gnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                            $jnum = M('look')->where(['look'=>10,'ment'=>$apost,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                            $this->assign('xnum',$xnum);
                            $this->assign('gnum',$gnum);
                            $this->assign('jnum',$jnum);
                            $this->assign('title',$title);
                            $this->assign('list',$x_list);
                            // $this->assign('y_list',$y_list);
                            $this->display();
                            break;
                          
                          
                        }
                      break;
                    case '4':   //行政
                        $db = M("look");
                            // $where = "a_id=".$uid;
                            $count = $db->where(['x_type'=>3,'look'=>2,'ju'=>0,'type'=>0])->count();
                            $pagecount = 9;
                            $page = new \Think\Page($count , $pagecount);
                            // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->where(['x_type'=>3,'look'=>2,'ju'=>0,'type'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '部门招待用品领用审批';
                            $xnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>2,'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                        $this->assign('xnum',$xnum);
                        $this->assign('gnum',$gnum);
                        $this->assign('jnum',$jnum);
                            $this->assign('list',$list);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                        $this->display();
                      break;
                    case '8':  //总经理(网)
                        // $apost = $glist[0]['post'];
                        $mlist = M('auth_group')->where(['mtype'=>1])->select();

                        foreach ($mlist as $vn) {
                        // echo $v['n_id'];
                        // exit;
                        // $ment .= "`ment`="."'".$vn['title']."'"." or ";
                        // $ment .= "'".$vn['title']."'"." , ";
                          $ments[] =  $vn['title'];
                          // 

                        }
                         $where = [
                                'ment' => [
                                    'in',
                                    $ments
                                ],
                                'look' => 1,
                                'x_type'=>3,
                                'type'=>0,
                                'ju'   => 0

                            ];

                    //          dump($where);
                        // exit;
                        // $ments = $ment."`look`= 1"." "."or"." "."`ju`= 0";
                        
                        
                        // $ment = "(".rtrim($ment,'or ').")"."AND"."("."`look`= 1"." "."AND"." "."`ju`= 0".")";
                        
                        // $ment =rtrim($ment,', ');
                        // echo $ment;
                        // exit;
                        // $x_list =  M('look')->where($where)->order('ment DESC')->limit(5)->select();
                        $db = M("look");
                        // $where = "a_id=".$uid;
                        $count = $db->where($where)->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where($where)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $this->assign('page',$show);
                        // $x_list = "SELECT * FROM oa_look where ment in($ment) AND (`look`= 1 AND `ju`=0)";
                        // dump($x_list);
                        // exit;
                        // $y_list = M('cost')->where(['x_type'=>1,'look'=>1,'ju'=>0,'ment'=>$ment])->order('id DESC')->limit(5)->select();
                        $title = '部门招待用品领用审批';
                        $xnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>3,'type'=>0])->count();
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                        $this->assign('xnum',$xnum);
                        $this->assign('gnum',$gnum);
                        $this->assign('jnum',$jnum);
                        $this->assign('title',$title);
                        $this->assign('list',$list);
                        // $this->assign('y_list',$y_list);
                        $this->display();
                        break;
                    case '9':  //总经理(职)
                        // $apost = $glist[0]['post'];
                        $mlist = M('auth_group')->where(['mtype'=>2])->select();
                        // dump($mlist);
                        // exit;
                        foreach ($mlist as $vn) {
                        // echo $v['n_id'];
                        // exit;
                        // $ment .= "`ment`="."'".$vn['title']."'"." or ";
                        // $ment .= "'".$vn['title']."'"." , ";
                          $ments[] =  $vn['title'];
                          // 

                        }
                         $where = [
                                'ment' => [
                                    'in',
                                    $ments
                                ],
                                'look' => 1,
                                'x_type'=>3,
                                'type'=>0,
                                'ju'   => 0

                            ];

                    //          dump($where);
                        // exit;
                        // $ments = $ment."`look`= 1"." "."or"." "."`ju`= 0";
                        
                        
                        // $ment = "(".rtrim($ment,'or ').")"."AND"."("."`look`= 1"." "."AND"." "."`ju`= 0".")";
                        
                        // $ment =rtrim($ment,', ');
                        // echo $ment;
                        // exit;
                        // $x_list =  M('look')->where($where)->order('ment DESC')->limit(5)->select();
                        $db = M("look");
                        // $where = "a_id=".$uid;
                        $count = $db->where($where)->count();
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where($where)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $this->assign('page',$show);
                        // $x_list = "SELECT * FROM oa_look where ment in($ment) AND (`look`= 1 AND `ju`=0)";
                        // dump($x_list);
                        // exit;
                        // $y_list = M('cost')->where(['x_type'=>1,'look'=>1,'ju'=>0,'ment'=>$ment])->order('id DESC')->limit(5)->select();
                        $this->assign('list',$list);
                        // $this->assign('y_list',$y_list);
                        $title = '部门招待用品领用审批';
                        $xnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>2,'type'=>0])->count();
                        $gnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>1,'type'=>0])->count();
                        $jnum = M('look')->where(['look'=>1,'ment'=>['in',$ments],'ju'=>0,'x_type'=>3,'type'=>0])->count();
                        // dump($jnum);
                        // exit;
                            // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                            
                        $this->assign('xnum',$xnum);
                        $this->assign('gnum',$gnum);
                        $this->assign('jnum',$jnum);
                        $this->assign('title',$title);
                        $this->display();
                      break;
                  


                  break;
                
                // $this->display();
              }
            }
    }







    public function jis()
    {
          // dump($_GET);
        // $type = $_GET['type'];
        $gid = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
        // dump($gid);
        // exit;
        $glist = M('auth_group')->where(['id'=>$gid[0]['group_id']])->select();
        // dump($glist);
        // exit;
        $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
        $apost = $glist[0]['post'];
         
      if ($glist[0]['title'] == '超级管理员') {
              $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(['type'=>3])->count();
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(['type'=>3])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门月度申请审批';
                  $this->assign('list',$list);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
        exit;
      }

        switch ($ulist[0]['m_type']) {
          case '2':   //主管
              $db = M("look");
              // echo '111';
              // exit;
                  // $where = "a_id=".$uid;
                  $count = $db->where(['type'=>1,'look'=>0,'ment'=>$apost,'ju'=>0])->count();
                  // dump($apost);
                  // exit;
                  $pagecount = 9;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(['type'=>1,'look'=>0,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门临时急性物品审批';
                  $this->assign('list',$list);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;



          case '3':   //经理


              switch ($apost) {
                case '行政中心':
                    $db = M("look");
                    // echo '111';
                    // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(['look'=>8,'type'=>1,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>8,'type'=>1,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门临时急性物品审批';


                        //---------------------------------------
                       
                        $lei = '行政';
                        $cao = 1;//行政操作分类
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                        $this->assign('cao',$cao);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                    $this->display();
                  break;

                case '采购中心':
                    $db = M("look");
                    // echo '111';
                    // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(['look'=>9,'type'=>1,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>9,'type'=>1,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门临时急性物品审批';


                        //---------------------------------------
                       
                    
                        $this->assign('list',$list);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                        $this->display();
                  break;
                case '财务中心':
                    $db = M("look");
                    
                        $count = $db->where(['look'=>10,'type'=>1,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>10,'type'=>1,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门临时急性物品审批';


                        //---------------------------------------
                       
                        $lei = '财务';
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                        $this->display();
                  break;
                
                
              }





              
            break;
          case '4':  //行政
              $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(array('type'=>1,'look'=>2,'ju'=>0))->count();
                  $pagecount = 9;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first'); 
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(array('type'=>1,'look'=>2,'ju'=>0))->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '公司临时急性物品审批';
            //       $Model = M('look');//或者 $Model = D(); 或者 $Model = M();
              // $sql = "SELECT * FROM oa_look WHERE `num` > `number` AND `type` = 3 AND `look` = 2 AND `ju` = 0 ";
              // $voList = $Model->query($sql);
              // dump($list);
              // exit;
                  // $ylist = $db->where(array('type'=>1,'look'=>2,'ju'=>0))->select();
                  // foreach ($ylist as  $v) {
                  //   $coun += $v['zong']; 
                  // }
                  // $title = '无库存月度需求申请';
            

              
                  $lei = '4';
                  $dao = 3;
                  $zong = 1;
              

                  $cao = 1;//行政操作分类
                  $this->assign('cao',$cao);
                  $this->assign('zong',$zong);
                  $this->assign('list',$list);
                  $this->assign('coun',$coun);
                  $this->assign('dao',$dao);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;

        

          case '5':  //财务
              $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(array('type'=>1,'look'=>3,'ju'=>0))->count();
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(array('type'=>1,'look'=>3,'ju'=>0))->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '公司临时急性物品审批';
                  $lei = 1;
                  $ylist = $db->where(array('type'=>1,'look'=>3,'ju'=>0))->select();
                  // foreach ($ylist as  $v) {
                  //   $coun += $v['zong']; 
                  // }
                  // $this->assign('coun',$coun);
                  $zong = 1;
                  $this->assign('zong',$zong);
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;



          case '9':  //职能总经理
              $db = M("look");
              $mlist = M('auth_group')->where(['mtype'=>2])->select();

              foreach ($mlist as $vn) {
            
                $ments[] =  $vn['title'];
              

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>1,
                      'ju'   => 0

                  ];

                
                  $count = $db->where($where)->count();
                  
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where($where)->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门临时急性物品审批';
                  $lei = '总经理';
                  // $ylist = $db->where(array('type'=>1,'look'=>1,'ju'=>0))->select();
                  // foreach ($ylist as  $v) {
                  //   $coun += $v['zong']; 
                  // }
                  $this->assign('coun',$coun);
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
                  $this->display();
            break;




          case '8':  //网络中心总经理
              $db = M("look");
              $mlist = M('auth_group')->where(['mtype'=>1])->select();

              foreach ($mlist as $vn) {
              // echo $v['n_id'];
              // exit;
              // $ment .= "`ment`="."'".$vn['title']."'"." or ";
              // $ment .= "'".$vn['title']."'"." , ";
                $ments[] =  $vn['title'];
                // 

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>1,
                      'ju'   => 0

                  ];

                  // dump($where);
                  // exit;
                  // $where = "a_id=".$uid;
                  $count = $db->where($where)->count();
                  // dump($count);
                  // exit;
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where($where)->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门临时急性物品审批';
                  // $lei = 1;
                  // $alist = M('look')->order('ment desc')->select();
                  // dump($alist);
                  // exit;
                  // $b = 0;
                  // foreach ($list as  $v) {
                  //  $b += $v['']
                  // }
                  // field()
                  $this->assign('list',$list);
                  // $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;


          case '6':  //董事办
                  $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(['type'=>1,'look'=>5,'ju'=>0])->count();
                  $pagecount = 10;
                 
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(['type'=>1,'look'=>5,'ju'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '公司临时急性物品审批';
                  $lei = 1;
                  // $alist = M('look')->order('ment desc')->select();
                  // dump($list);
                  // exit;
                  // $b = 0;
                  // foreach ($list as  $v) {
                  //  $b += $v['']
                  // }
                  // field()
                 
                  // $this->assign('coun',$coun);
                  $zong = 1;
                  $this->assign('zong',$zong);
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
              $this->display();
            break;

          }
    }









  //公司所有类型审批模版页面
  public function jsuo()
  {
    $gid = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    // dump($gid);
    // exit;
    $glist = M('auth_group')->where(['id'=>$gid[0]['group_id']])->select();
    // dump($glist);
    // exit;
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    $apost = $glist[0]['post'];
    // dump($_GET);
          switch ($ulist[0]['m_type']) {
            case '3':   //经理
                switch ($apost) {
                  case '行政中心':
                        $db = M("look");
                        // echo '111';
                        // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(['look'=>2,'type'=>1,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>2,'type'=>1,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '公司临时急性物品审批';

                        // dump($list);
                        // exit;
                        //---------------------------------------
                       
                        $lei = '行政';
                        $cao = 1;//行政操作分类
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                        $this->assign('cao',$cao);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                    $this->display();
                  break;

                
                case '财务中心':
                        $db = M("look");
                    
                        $count = $db->where(['look'=>3,'type'=>1,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>3,'type'=>1,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '公司临时急性物品审批';


                        //---------------------------------------
                       
                        $lei = '财务';
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                        $this->display();
                  break;
                
                
              }





              
            break;
          case '9':  //职能总经理
              $db = M("look");
                    
              $count = $db->where(['look'=>4,'type'=>1,'ju'=>0])->count();
              // dump($count);
              // exit;
              $pagecount = 9;
              $page = new \Think\Page($count , $pagecount);
              $page->parameter = $row; //此处的row是数组，为了传递查询条件
              $page->setConfig('first');
              $page->setConfig('prev','上一页');
              $page->setConfig('next','下一页');
              $page->setConfig('last','尾页');
              $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
              $show = $page->show();
              $list = $db->where(['look'=>4,'type'=>1,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
              $title = '公司临时急性物品审批';


              //---------------------------------------
                       
              $lei = '总经理';
              $this->assign('list',$list);
              $this->assign('lei',$lei);
                       
              $this->assign('page',$show);
                        
              $this->assign('title',$title);
              $this->display();
            break;
          }
 
    
  }





  public function xiu()
  {

    $id = $_POST['id'];
    $data = $_POST;
    // $data['zong'] = $_POST['num'] * $_POST['unit'];
    $ce = M('look')->where(['id'=>$id])->find();
    // dump($data);
    // exit;
    if ($_POST['unit'] == $ce['unit'] && $_POST['num'] == $ce['num']) {
      echo '3';
      exit;
      // exit;
    }
    

    if (M('look')->where(['id'=>$id])->save($data) > 0) {
    
      
        // $coun['dan'] = $data['zong'];
      // $this->ajaxReturn($coun);
      echo '1111';
    }else{
      $arr = 2;
      $this->ajaxReturn($arr);
    }
  }












 public function yjsuo()
 {
    $gid = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    // dump($gid);
    // exit;
    $glist = M('auth_group')->where(['id'=>$gid[0]['group_id']])->select();
    // dump($glist);
    // exit;
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    $apost = $glist[0]['post'];
    switch ($ulist[0]['m_type']) {
            case '3':   //经理
                switch ($apost) {
                  case '行政中心':
                        $db = M("look");
                        // echo '111';
                        // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>2,'ju'=>0))->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>2,'ju'=>0))->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '公司临时急性物品审批';

                        // dump($list);
                        // exit;
                        //---------------------------------------
                       
                        $lei = '行政';
                        $cao = 1;//行政操作分类
                        $ylist = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>2,'ju'=>0))->select();
                        foreach ($ylist as  $v) {
                          $coun += $v['zong']; 
                        }
                        $this->assign('coun',$coun);
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                        $this->assign('cao',$cao);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                    $this->display();
                  break;

                
                case '财务中心':
                        $db = M("look");
                    
                        $count = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>3,'ju'=>0))->count();
                        // dump($count);
                        // exit;
                        $pagecount = 9;
                        $page = new \Think\Page($count , $pagecount);
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>3,'ju'=>0))->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '公司临时急性物品审批';


                        //---------------------------------------
                        
                        $lei = '财务';
                        $ylist = $db->where(array('num'=>array('exp',' >number '),'type'=>3,'look'=>3,'ju'=>0))->select();
                        foreach ($ylist as  $v) {
                          $coun += $v['zong']; 
                        }
                        $this->assign('coun',$coun);
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                        $this->display();
                  break;
                
                
              }





              
            break;
          case '9':  //职能总经理
              $db = M("look");
              $mlist = M('auth_group')->where(['mtype'=>2])->select();

              foreach ($mlist as $vn) {
            
                $ments[] =  $vn['title'];
              

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 4,
                      'type'=>3,
                      'ju'   => 0

                  ];

                
                  $count = $db->where($where)->count();
                  
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where($where)->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '公司临时急性物品审批';
                  $lei = '总经理';
                  $ylist = $db->where(array('type'=>3,'look'=>4,'ju'=>0))->select();
                  foreach ($ylist as  $v) {
                    $coun += $v['zong']; 
                  }
                  $this->assign('coun',$coun);
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
                  $this->display();
            break;
          }          
 }




//月度申请审批展示库存已有物资
  public function ku()
  { 
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    // dump($ulist);
    // exit;
    switch ($ulist[0]['m_type']) {
      case '4'://行政主管
        // $arr = M('look')->where('num','<','number')->select();
              $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(array('number'=>array('exp',' >=num '),'type'=>3,'look'=>2,'ju'=>0))->count();
                  $pagecount = 9;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(array('number'=>array('exp',' >=num '),'type'=>3,'look'=>2,'ju'=>0))->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
              // dump($list);
              // exit;
            $ylist = $db->where(array('number'=>array('exp',' >=num '),'type'=>3,'look'=>2,'ju'=>0))->select();
            foreach ($ylist as  $v) {
              $coun += $v['zong']; 
            }
        $lei = 1;
        $title = '库存已有月度申请';
        $this->assign('coun',$coun);
        $this->assign('lei',$lei);
        $this->assign('title',$title);
        $this->assign('list',$list);
        $this->assign('page',$show);

        $this->display();
        break;
      case '3'://行政经理
        // $arr = M('look')->where('num','<','number')->select();
        $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(array('number'=>array('exp',' >=num '),'type'=>3,'look'=>2,'ju'=>0))->count();
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(array('number'=>array('exp',' >=num '),'type'=>3,'look'=>2,'ju'=>0))->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
              // dump($list);
              // exit;
        $ylist = $db->where(array('number'=>array('exp',' >=num '),'type'=>3,'look'=>2,'ju'=>0))->select();
            foreach ($ylist as  $v) {
              $coun += $v['zong']; 
            }
        $title = '库存已有月度申请';
        $lei = 2;
        $this->assign('lei',$lei);
        $this->assign('coun',$coun);
        $this->assign('title',$title);
        $this->assign('list',$list);
        $this->assign('page',$show);

        $this->display();
        break;
      
    }
    
            
  }










  //查看所有办公用品领用通过申请
    public function bsuo()
    {
        $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
        $uname = $ulist[0]['user'];
        $alist = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
        $glist = M('auth_group')->where(['id'=>$alist[0]['group_id']])->select();
        if ($ulist[0]['m_type'] >= 3) {
            $db = M("look");
            // $where = "a_id=".$uid;
            $count = $db->where(['look'=>3,'ju'=>0,'type'=>0,'que'=>0])->count();
            $pagecount = 20;
            $page = new \Think\Page($count , $pagecount);
                          // $row[] = '';
            $page->parameter = $row; //此处的row是数组，为了传递查询条件
            $page->setConfig('first','第一页');
            $page->setConfig('prev','上一页');
            $page->setConfig('next','下一页');
            $page->setConfig('last','尾页');
            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
            $show = $page->show();
            $list = $db->where(['look'=>3,'ju'=>0,'type'=>0,'que'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
            $title = '已通过办公用品领用审批';
            if ($glist[0]['post'] == '行政中心') {
                $lei = '行政';
                $this->assign('lei',$lei);
            }
            // dump($lei);
            // exit;
            $this->assign('list',$list);
            // $this->assign('coun',$coun);
            // $this->assign('dao',$dao);
            // $this->assign('lei',$lei);
            $this->assign('page',$show);
            $this->assign('title',$title);
            $this->display();
        }else{
            $db = M("cost");
            // $where = "a_id=".$uid;
            $count = $db->where(['look'=>3,'ju'=>0,'uname'=>$uname,'type'=>0,'que'=>0])->count();
            $pagecount = 20;
            $page = new \Think\Page($count , $pagecount);
                          // $row[] = '';
            $page->parameter = $row; //此处的row是数组，为了传递查询条件
            $page->setConfig('first','第一页');
            $page->setConfig('prev','上一页');
            $page->setConfig('next','下一页');
            $page->setConfig('last','尾页');
            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
            $show = $page->show();
            $list = $db->where(['look'=>3,'ju'=>0,'uname'=>$uname,'type'=>0,'que'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
            $title = '已通过办公用品领用审批';
            $this->assign('list',$list);
            // $this->assign('coun',$coun);
            // $this->assign('dao',$dao);
            // $this->assign('lei',$lei);
            $this->assign('page',$show);
            $this->assign('title',$title);
            $this->display();
        }
       

    }






    //查看所有办公用品领用拒绝
    public function bjue()
    {
        $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
        $ment = $ulist[0]['upost'];
        $uname = $ulist[0]['user'];
        $alist = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
        $glist = M('auth_group')->where(['id'=>$alist[0]['group_id']])->select();
        if ($ulist[0]['m_type'] >= 3) {
            switch ($ulist[0]['m_type']) {
                case '3':   //经理
                  $db = M("look");
                  // $apost = $glist[0]['post'];
                  // $x_list = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->select();
                  $count = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[3,4,5,6]],'oa_look.type'=>0])->count();
                  // dump($count);
                  // exit;
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[3,4,5,6]],'oa_look.type'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  // $xnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->count();
                  // $gnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>2])->count();
                  // $jnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>1])->count();
                  // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                   $title = '被拒绝办公用品领用审批';
                  $this->assign('list',$list);
                  $this->assign('title',$title);
                  $this->assign('page',$show);
                  // $this->assign('xnum',$xnum);
                  // $this->assign('gnum',$gnum);
                  // $this->assign('jnum',$jnum);
                  // $this->assign('y_list',$y_list);
                  $this->display();
                  break;
                case '5':   //财务
                  $db = M("cost");
                  // $apost = $glist[0]['post'];
                  // $x_list = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->select();
                  $count = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[5,6]],'oa_look.type'=>0])->count();
                  // dump($count);
                  // exit;
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[5,6]],'oa_look.type'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  // $xnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->count();
                  // $gnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>2])->count();
                  // $jnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>1])->count();
                  // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                  $this->assign('list',$list);
                  $this->assign('page',$show);
                   $title = '被拒绝办公用品领用审批';
                  $this->assign('title',$title);
                  // $this->assign('xnum',$xnum);
                  // $this->assign('gnum',$gnum);
                  // $this->assign('jnum',$jnum);
                  // $this->assign('y_list',$y_list);
                  $this->display();
                  break;
                case '4':   //行政

                  $db = M("look");
                  // $apost = $glist[0]['post'];
                  // $x_list = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->select();
                  $count = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[3,4,5,6]],'oa_look.type'=>0])->count();
                  // dump($count);
                  // exit;
                  $pagecount = 20;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[3,4,5,6]],'oa_look.type'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  // $xnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->count();
                  // $gnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>2])->count();
                  // $jnum = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>1])->count();
                  // $y_list = M('cost')->where(['look'=>0,'ment'=>$apost,'ju'=>0,])->order('id DESC')->limit(5)->select();
                  $this->assign('list',$list);
                  $this->assign('page',$show);
                   $title = '被拒绝办公用品领用审批';
                  $this->assign('title',$title);
                  // $this->assign('xnum',$xnum);
                  // $this->assign('gnum',$gnum);
                  // $this->assign('jnum',$jnum);
                  // $this->assign('y_list',$y_list);
                 
                  $this->display();
                  break;
                case '6':   //董事办
                  $db = M("look");
                  // $apost = $glist[0]['post'];
                  // $x_list = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'type'=>0])->order('id DESC')->select();
                  $count = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>'6','oa_look.type'=>0])->count();
                  // dump($count);
                  // exit;
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>'6','oa_look.type'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                 
                  $this->assign('list',$list);
                  $this->assign('page',$show);
                    $title = '被拒绝办公用品领用审批';
                  $this->assign('title',$title);
               
                  $this->display();
                  break;
                case '9':   //总经理
                  $db = M("look");
                  // $apost = $glist[0]['post'];
                  // $x_list = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'oa_look.type'=>0])->order('id DESC')->select();
                  $count = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[3,4,5,6]],'oa_look.type'=>0])->count();
                  // dump($count);
                  // exit;
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[3,4,5,6]],'oa_look.type'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                   $title = '被拒绝办公用品领用审批';
                  $this->assign('title',$title);
                  $this->assign('list',$list);
                  $this->assign('page',$show);
                  
                  $this->display();
                  break;
                case '8':   //总经理
                  $mlist = M('auth_group')->where(['mtype'=>1])->select();

                  foreach ($mlist as $vn) {
                  // echo $v['n_id'];
                  // exit;
                  // $ment .= "`ment`="."'".$vn['title']."'"." or ";
                  // $ment .= "'".$vn['title']."'"." , ";
                  $ments[] =  $vn['post'];
                    // 

                  }
                  $db = M("look");
                  // $apost = $glist[0]['post'];
                  // $x_list = M('look')->where(['look'=>0,'ment'=>$apost,'ju'=>0,'oa_look.type'=>0])->order('id DESC')->select();
                  $count = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[3,4,5,6]],'oa_look.type'=>0,'oa_look.ment'=>['in',$ments]])->count();
                  // dump($count);
                  // exit;
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['in',[3,4,5,6]],'oa_look.type'=>0,'oa_look.ment'=>['in',$ments]])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                   $title = '被拒绝办公用品领用审批';
                  $this->assign('title',$title);
                  $this->assign('list',$list);
                  $this->assign('page',$show);
                  
                  $this->display();
                  break;
            }
        }else{
            $db = M("look");
            
            $count = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['neq',0],'oa_look.ment'=>$ment,'oa_look.type'=>0])->count();
            // dump($count);
            // exit;
            $pagecount = 15;
            $page = new \Think\Page($count , $pagecount);

                          // $row[] = '';
            $page->parameter = $row; //此处的row是数组，为了传递查询条件
            $page->setConfig('first','第一页');
            $page->setConfig('prev','上一页');
            $page->setConfig('next','下一页');
            $page->setConfig('last','尾页');
            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
            $show = $page->show();

            $list = $db->join('oa_sh as t1 on t1.sid = oa_look.id')->where(['oa_look.ju'=>['neq',0],'oa_look.ment'=>$ment,'oa_look.type'=>0])->order('time desc')->limit($page->firstRow.','.$page->listRows)->select();

            // dump($list);
            // exit;
            $title = '被拒绝办公用品领用审批';
            $this->assign('title',$title);
            $this->assign('list',$list);
            // $this->assign('coun',$coun);
            // $this->assign('dao',$dao);
            // $this->assign('lei',$lei);
            $this->assign('page',$show);
            $this->assign('title',$title);
            $this->display();
        }
       

    }









    public function que()
    {
      
      $llist = M('look')->where(['id'=>$_POST['id']])->find();
      
      $que['que'] = '1';
      $que['number'] = $llist['number'] - $llist['num'];
      $number['number'] = $llist['number'] - $llist['num'];
      // dump($que);
      // exit;
      if (M('look')->where(['id'=>$_POST['id']])->save($que) > 0 ) {
          if (M('stock')->where(['id'=>$llist['wid']])->save($number) > 0) {
              echo '1111';
          }else{
              echo '2222';
          }
      }


    }











}